import { http } from '@/utils/http/axios';

/**
 * @description: 根据用户id获取用户菜单
 */
export function adminMenus() {
  return http.request({
    url: '/menus',
    method: 'GET',
  },
    {
      isTransformResponse: false,
    });
}

/**
 * 获取tree菜单列表
 * @param params
 */
export function getMenuList(params?) {
  return http.request({
    url: '/menu/list',
    method: 'GET',
    params,
  },
    {
      isTransformResponse: false,
    });
}

/**
 * 添加菜单
 * @param params
 */
export function addMenu(params?) {
  return http.request({
      url: '/menu',
      method: 'PUT',
      params,
    },
    {
      isTransformResponse: false,
    });
}

/**
 * 编辑菜单
 * @param params
 */
export function editMenu(params?) {
  return http.request({
      url: '/menu',
      method: 'POST',
      params,
    },
    {
      isTransformResponse: false,
    });
}

/**
 * 删除菜单
 * @param id
 */
export function delMenu(id) {
  return http.request({
      url: `/menu/${id}`,
      method: 'DELETE',
    },
    {
      isTransformResponse: false,
    });
}
